public class copay {
    //定义一个方法copyOfRange(int[] arr, int from, int to)将数组arr中从索引from （包含from)开始。
    //到索引to结束（不包含to)的元素复制到新数组
    public static void main(String[] args) {
        int arr[] = {1 , 2 , 3 , 4 , 5 , 6 , 7};
        int[] ints = copyRamge(arr, 3, 7);
        for (int i = 0; i < ints.length; i++) {
            System.out.println(ints[i]);
        }
    }
     public static int[] copyRamge(int arr[] , int from , int to){
        int newArr[] = new int[to - from];
        int nex = 0;
        for(  ; from < to ; from++){
           newArr[nex] = arr[from];
           nex++;
        }
           return newArr;
     }



}
